<template>
  <div class="header1"> 
    <span class="backicon">
        <span v-if="pathname=='item'" class="page-header-back" @click='goback'></span>
    </span>
    <span><slot>猫眼电影</slot></span>
    
    <span>
        <span v-if="pathname !== 'item'">
            三
        </span>
    </span>
  </div>
</template>

<script>
export default {
  name: "header1",
  data:function(){
      return {
          pathname:''
      }
  },
  mounted () {
      console.log(this.$route);
      this.pathname=this.$route.name
  },
  methods: {
      goback(){
          this.$router.go(-1)
      }
  }

};
</script>

<style scoped>
.mao{
    margin: 0 auto;
}
.header1 {
  width: 100%;
  height: 50.5px;
  line-height: 50.5px;
  display: flex;
  background: #e54847;
  color: #fff;
  font-size: 18px;
}
.backicon {
  position: relative;
}
.page-header-back:before {
  width: 20px;
  height: 20px;
  content: "";
  display: flex;
  position: absolute;
  top: 15px;
  /* width: 100%; */
  /* height: 100%; */
  box-sizing: border-box;
  border-bottom: 2px solid #fff;
  border-left: 2px solid #fff;
  transform: rotate(45deg);
  left: 20px;
}
.header1 span:nth-of-type(1),
.header1 span:nth-of-type(3) {
  width: 15%;
}
.header1 span:nth-of-type(2) {
  width: 70%;
  text-align: center;
}
 
</style>